<!--
  @author duanzuocai
  @since 2018/10/23 15:12
-->
<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-4.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head th:include="common/common::jscss"/>
<body>

<div class="layui-fluid">

    <div class="layui-card">

        <div class="layui-card-body">

            <!--表单样式统一为layui-form(必需样式)，lay-filter属性统一定义为zmn-form-->
            <form method="POST" action="" class="layui-form" lay-filter="zmn-form">

                <input type="hidden" name="addFlag" th:value="${brandId == 0 ? true: false}"/>

                <div class="layui-form-item">
                    <label style="color: #9F9F9F;">系数值范围 0.6~3.0，最多两位小数</label>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-required">品牌：</label>
                    <div class="layui-input-inline">
                        <select th:disabled="${brandId > 0}" name="brandId" id="brandId" lay-search="" lay-verify="required" th:value="${brandId}">
                            <option value="">请选择</option>
                            <zmn th:each="brand:${baseBrandList}">
                                <option th:value="${brand.brandId}" th:selected="${brand.brandId == brandId}"
                                        th:text="${brand.name}">品牌
                                </option>
                            </zmn>
                        </select>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-required">影响价格：</label>
                    <div class="layui-input-inline">
                        <select th:disabled="${brandId > 0}" name="priceType" id="priceType" lay-search="" lay-verify="required" th:value="${priceType}">
                            <option value="1" th:selected="${priceType == null || priceType == 1}">销售价</option>
                            <option value="2" th:selected="${priceType == 2}">内部价</option>
                        </select>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">C默认系数：</label>
                    <div class="layui-input-inline" style="width:200px;">
                        <input type="number" name="outRatio" autocomplete="off" class="layui-input" th:value="${#numbers.formatDecimal((brandRatioC.toBeEffectiveRatio == null ? brandRatioC.ratio: brandRatioC.toBeEffectiveRatio),1,'COMMA',2,'POINT')}">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">F默认系数：</label>
                    <div class="layui-input-inline" style="width:200px;">
                        <input type="number" name="inRatio" autocomplete="off" class="layui-input" th:value="${#numbers.formatDecimal((brandRatioF.toBeEffectiveRatio == null ? brandRatioF.ratio: brandRatioF.toBeEffectiveRatio),1,'COMMA',2,'POINT')}">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">B默认系数：</label>
                    <div class="layui-input-inline" style="width:200px;">
                        <input type="number" name="projectRatio" autocomplete="off" class="layui-input" th:value="${#numbers.formatDecimal((brandRatioB.toBeEffectiveRatio == null ? brandRatioB.ratio: brandRatioB.toBeEffectiveRatio),1,'COMMA',2,'POINT')}">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">计价器3.0系数：</label>
                    <div class="layui-input-inline" style="width:200px;">
                        <input type="number" name="meterRatio" autocomplete="off" class="layui-input" th:value="${#numbers.formatDecimal((brandRatioM.toBeEffectiveRatio == null ? brandRatioM.ratio: brandRatioM.toBeEffectiveRatio),1,'COMMA',2,'POINT')}">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">生效日期：</label>
                    <div class="layui-input-inline">
                        <input type="text" id="effectiveDate" name="effectiveDate" placeholder="yyyy-MM-dd" class="layui-input"
                               autocomplete="off" readonly/>
                    </div>
                    <div class="layui-input-inline">
                        <label style="color: #9F9F9F;width: 400px">生效日期选择后，配置的数据将在该日期的0点生效，不填则默认次日0：00生效 </label>
                    </div>
                </div>

                <div class="layui-split">&nbsp;</div>
                <div class="layui-split">&nbsp;</div>
                <div class="layui-split">&nbsp;</div>
                <div class="layui-split">&nbsp;</div>
                <div class="layui-split">&nbsp;</div>
                <div class="layui-split">&nbsp;</div>
                <div class="layui-split">&nbsp;</div>

                <!--按钮栏
                    置于form标签内的最下方，
                    主功能按钮使用默认样式，次要功能按钮使用原始按钮(加入样式layui-btn-primary)
                    -->
                <div class="layui-form-item submit">
                    <div class="layui-input-block">
                        <button class="layui-btn" lay-submit="" lay-filter="zmn-form-submit">提交</button>
                        <button onclick="parent.layui.element.tabDelete('layadmin-layout-tabs', window.location.pathname + window.location.search)" class="layui-btn layui-btn-primary" id="cancel">取消</button>
                    </div>
                </div>
            </form>
        </div>
    </div>

</div>
</body>
</html>

<script type="text/javascript" th:inline="javascript">
    layui.config({
        base: "/static/lay/"
    }).extend({
        index: "lib/index",
        serv_brandratio_edit: "brand/ratio/zmn.plat.brandratio.edit",
    }).use(['index', 'serv_brandratio_edit']);

</script>